﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

using Wicresoft.Common;
using Wicresoft.Framework.Organization;
using JDEduTrain.Framework.Business;
using JDEduTrain.Framework.Entity;


public partial class Page_NewLectorExperience : System.Web.UI.Page
{
    private Guid LectorID
    {
        get
        {
            if (Request["LectorID"] != null)
            {
                return new Guid(Request["LectorID"]);

            }
            return Guid.Empty;
        }
    }
    private Guid ExperienceID
    {
        get
        {
            if (Request["ExperienceID"] != null)
            {
                return new Guid(Request["ExperienceID"]);

            }
            return Guid.Empty;
        }
    }


    protected void Page_Load(object sender, EventArgs e)
    {
        this.Title = "新建讲课经历";


        if (!IsPostBack)
        {
            if (LectorID != Guid.Empty && ExperienceID != Guid.Empty)
            {

                LectorExperience expe = new LectorExperience(ExperienceID, LectorID);
                if (expe.Load())
                {
                    tbBeginTime.Text = expe.BeginTime.ToShortDateString();
                    tbEndTime.Text = expe.EndTime.ToShortDateString();
                    tbMainContent.Text = expe.MainContent;
                    tbTrainClassName.Text = expe.TrainClassName;
                }
                this.Title = "编辑讲课经历";
            }

        }
    }

    protected void lbtnSave_Click(object sender, EventArgs e)
    {
        LectorExperience expe = new LectorExperience(ExperienceID, LectorID);
        if (!expe.Load())
        {
            expe.ID = Guid.NewGuid();
            expe.LectorInfoID = LectorID;
        }
        if (!string.IsNullOrEmpty(tbBeginTime.Text))
        {
            expe.BeginTime = Convert.ToDateTime(tbBeginTime.Text);
        }
        if (!string.IsNullOrEmpty(tbEndTime.Text))
        {
            expe.EndTime = Convert.ToDateTime(tbEndTime.Text);
        }
        expe.MainContent = tbMainContent.Text;
        expe.TrainClassName = tbTrainClassName.Text;
        expe.Save();


        string script = "<script>alert('保存成功!');refreshParent();window.close();</script>";
        ClientScript.RegisterStartupScript(this.GetType(), "Close", script);
    }
}
